﻿using Aspose.Cells;
using Bentley.DgnPlatformNET.Elements;
using Bentley.GeometryNET;
using Bentley.Internal.MstnPlatformNET;
using CheccCoverplateCulvertAssemble.Common;
using CheccCoverplateCulvertAssemble.Conmmon;
using CheccCoverplateCulvertAssemble.Entity;
using CheccCoverplateCulvertAssemble.Rebar;
using CheccCoverplateCulvertAssemble.Tools;
using CheccTexturePropertyGive;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static Bentley.CIMNET.CIMGeometry.Solid.SolidUtil.Modify;
using static CheccTexturePropertyGive.SetCoverCulvertTexture;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

namespace CheccCoverplateCulvertAssemble.Operation
{
    internal class BracingBeam : ConstructingEntity
    {
        RebarEntity rebarEntity;
        public BracingBeam(BasicConstructor basicConstructor, RebarEntity rebarEntity,  CulvertType culvertType, ConstructionMethod constructionMethod, CulvertComponentType culvertComponentType) : base(basicConstructor, culvertType, constructionMethod, culvertComponentType)
        {
            this.rebarEntity = rebarEntity;
        }

        public override void CreateEntityModel()
        {
            var objParameter = GetUorCoverParameter();
            var bracingBramParameter = GetBracingBeamParameter();

            //涵身左右两侧偏移长度
            double LeftLateralOffset = Math.Abs((objParameter.standPly + objParameter.clearSpan / 2 + objParameter.basicsEdge) * Math.Tan((90 - objParameter.leftLateralAngle) * Math.PI / 180));
            double RightLateralOffset = Math.Abs((objParameter.standPly + objParameter.clearSpan / 2 + objParameter.basicsEdge) * Math.Tan((90 - objParameter.rightLateralAngle) * Math.PI / 180));
            //总长
            double overallLength = bracingBramParameter.culvertLenLists.Take(bracingBramParameter.culvertLenLists.Count).Sum() * 0.01;
            //正涵身长度
            double culverLength = (overallLength - LeftLateralOffset - RightLateralOffset) / 2;
            //左侧摆放长度
            double putLength = culverLength - bracingBramParameter.bracingBeamWidth / 2 - 1;
            //摆放个数
            int numX = (int)Math.Floor(putLength / 2) + 1;
            if (putLength - 2 * (numX - 1) > 0.5) numX += 1;
            double staZ = objParameter.piecePly + objParameter.clearHeight;
            double a = Math.Atan(objParameter.baseSlope) * 180 / Math.PI;
            Angle angle = Angle.FromDegrees(Math.Atan(objParameter.baseSlope) * 180 / Math.PI);
            for (int i = 0; i < numX; i++)
            {
                double staX = i == numX - 1 ? LeftLateralOffset + bracingBramParameter.bracingBeamWidth / 2 : LeftLateralOffset + culverLength - 1 - (2*i);

                for (int j = 0; j < bracingBramParameter.culvertLenLists.Count; j++)
                {
                    double var = bracingBramParameter.culvertLenLists.Take(j+1).Sum() * 0.01;
                    if (var > staX - bracingBramParameter.bracingBeamWidth / 2  && var < staX + bracingBramParameter.bracingBeamWidth / 2)
                    {
                        staX =staX + var - (staX - bracingBramParameter.bracingBeamWidth / 2) + objParameter.culvertGapWidth/2;
                        break;
                    }
                }

                double offsetZ = staX * objParameter.baseSlope;
                DPoint3d movePoint3d = new DPoint3d(staX, 0, -staZ + offsetZ) * GeneralBank.UorToMeters;
                DTransform3d trans = DTransform3d.FromRotationAroundLine(DPoint3d.Zero, new DVector3d(0, 1, 0), -angle);
                trans.Translation = movePoint3d;
                CraeteBracings(trans);
            }

            for (int i = 0; i < numX; i++)
            {
                double staX = i == numX - 1 ? overallLength - RightLateralOffset - bracingBramParameter.bracingBeamWidth / 2 : LeftLateralOffset + culverLength + 1 + (2 * i);

                for (int j = 0; j < bracingBramParameter.culvertLenLists.Count; j++)
                {
                    double var = bracingBramParameter.culvertLenLists.Take(j + 1).Sum() * 0.01;
                    if (var > staX - bracingBramParameter.bracingBeamWidth / 2 && var < staX + bracingBramParameter.bracingBeamWidth / 2)
                    {
                        staX = staX + var -(staX + bracingBramParameter.bracingBeamWidth / 2)  - objParameter.culvertGapWidth / 2;
                        break;
                    }
                }
                double offsetZ = staX * objParameter.baseSlope;
                DPoint3d movePoint3d = new DPoint3d(staX, 0, -staZ + offsetZ) * GeneralBank.UorToMeters;
                DTransform3d trans = DTransform3d.FromRotationAroundLine(DPoint3d.Zero, new DVector3d(0, 1, 0), -angle);
                trans.Translation = movePoint3d;
                CraeteBracings(trans);
            }
        }

        public void CraeteBracings(DTransform3d dTransform)
        {
            var bracingBramParameter = GetBracingBeamParameter();
            DPoint3d[] points =
            {
                new DPoint3d(-bracingBramParameter.bracingBeamWidth/2,0,0) * GeneralBank.UorToMeters,
                new DPoint3d(bracingBramParameter.bracingBeamWidth/2,0,0) * GeneralBank.UorToMeters,
                new DPoint3d(bracingBramParameter.bracingBeamWidth/2,0,bracingBramParameter.bracingBeamHeight) * GeneralBank.UorToMeters,
                new DPoint3d(-bracingBramParameter.bracingBeamWidth/2,0,bracingBramParameter.bracingBeamHeight) * GeneralBank.UorToMeters,
                new DPoint3d(-bracingBramParameter.bracingBeamWidth/2,0,0) * GeneralBank.UorToMeters,
            };

            ShapeElement shapeElement = new ShapeElement(GeneralBank.ActiveDgnModel, null, points);
            CurveVector secCur = shapeElement.GetCurveVector();
            LineElement lineElement = new LineElement(GeneralBank.ActiveDgnModel, null,
                new DSegment3d(DPoint3d.Zero, new DPoint3d(0, bracingBramParameter.racingBeamLength, 0) * GeneralBank.UorToMeters));
            CurveVector linePath = lineElement.GetCurveVector();
            SolidKernelEntity solidKernel = CreateBodyFromSweep(linePath, secCur, GeneralBank.ActiveDgnModel);

            DPoint3d movePoint3d = new DPoint3d(0, -bracingBramParameter.racingBeamLength / 2, 0) * GeneralBank.UorToMeters;
            DTransform3d trans = DTransform3d.Identity;
            trans.Translation = movePoint3d;
            TransformBody(ref solidKernel, trans);
            Convert1.BodyToElement(out Element resultElement, solidKernel, null, GeneralBank.ActiveDgnModel);

            TransformInfo transformInfo = new TransformInfo(dTransform);
            resultElement.ApplyTransform(transformInfo);

            //真实位置
            DTransform3d dTransform3d = new DTransform3d(this.dMatrix3D);
            dTransform3d.Translation = this.placeDpoint3d * GeneralBank.UorToMeters;
            TransformInfo dTransFormInfo = new TransformInfo(dTransform3d);
            resultElement.ApplyTransform(dTransFormInfo);
            resultElement.AddToModel();
            CommonData.Instance.ElementIds.Add(resultElement.ElementId.ToString());

            //属性赋予
            SetCoverCulvertECProperty setCoverCulvertECProperty = new SetCoverCulvertECProperty();
            setCoverCulvertECProperty.SetbraceSummerECProperty(
                resultElement,
                bracingBramParameter.racingBeamLength.ToString(),
                bracingBramParameter.bracingBeamWidth.ToString(),
                bracingBramParameter.bracingBeamHeight.ToString(),
                "",
                "",
                "",
                "",
                "",
                ""
                );
            //材质赋予
            SetCoverCulvertTexture setCoverCulvertTexture = new SetCoverCulvertTexture();
            setCoverCulvertTexture.CoverCulvertTexture(resultElement, CoverCulvertConstruction.SupportBeam);

            //工程数量
            FormColl.Assemble.SetTableData("支撑梁", "混凝土", GeneralHelpers.GetCSVDatas("支撑梁")["混凝土等级"], SetCoverCulvertECProperty.GetVolume(resultElement, Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp), "m³");

            //创建钢筋实体
            if (this.RebarList.Any())
            {
                foreach (var rebar in this.RebarList)
                {
                    Element rebarEle = rebar.CreateEntityModel();
                    if (rebarEle != null)
                    {
                        rebarEle.ApplyTransform(transformInfo);
                        rebarEle.ApplyTransform(dTransFormInfo);
                        rebarEle.AddToModel();
                        rebar.AddElmentMaterial(rebarEle);
                        CommonData.Instance.ElementIds.Add(rebarEle.ElementId.ToString());
                        //工程数量
                        FormColl.Assemble.SetTableData("支撑梁", "钢筋", GeneralHelpers.GetCSVDatas("支撑梁")["混凝土等级"], SetCoverCulvertECProperty.GetVolume(resultElement, Bentley.MstnPlatformNET.InteropServices.Utilities.ComApp), "m³");
                    }
                }
            }
        }

        public override List<RebarBase> CreateRebarList()
        {
            List<RebarBase> rebarList = new();
            if (this.rebarEntity.dgv_Rebar1.Count == 0) return rebarList;
            rebarList.AddRange(this.CreateRebarListNum1());
            rebarList.AddRange(this.CreateRebarListNum2());
            return rebarList;
        }
        private List<RebarBase> CreateRebarListNum1()
        {
            List<RebarBase> rebarList = new();
            var bracingBramParameter = GetBracingBeamParameter();
            var rebar1 = GetRebarParametersOfNum1();
            
            double CastInPlaceLayer = 12.0 /100; 
            double PrecastLayer = 16.0 / 100;
            double padding = 7.0 / 100;
            //钢筋长度
            double rebarLength = 0; 
            if (this.ConstructionMethod == ConstructionMethod.CastInPlace) //现浇
            {
                rebarLength = bracingBramParameter.racingBeamLength - CastInPlaceLayer;
            }
            else
            {
                rebarLength = bracingBramParameter.racingBeamLength - PrecastLayer; 
            }

            //摆放间距
            double putDistance = (bracingBramParameter.bracingBeamWidth - padding * 2) / 2;
            //水平顶部
            for (int i = 0; i < 3; i++)
            {
                LineElement lineElement = new LineElement(GeneralBank.ActiveDgnModel, null, new DSegment3d(
                    new DPoint3d(-bracingBramParameter.bracingBeamWidth / 2 + padding + putDistance * i, rebarLength/2, bracingBramParameter.bracingBeamHeight - padding) * GeneralBank.UorToMeters, 
                    new DPoint3d(-bracingBramParameter.bracingBeamWidth / 2 + padding + putDistance * i, -rebarLength / 2, bracingBramParameter.bracingBeamHeight - padding) * GeneralBank.UorToMeters));
                RebarBase rebarBase1 = new Rebar_90Degrees(this, "1", rebar1.diameter, rebar1.rebarGrade, RebarType.NoRibbed, lineElement.GetCurveVector(), rebar1.hookLength, rebar1.diameter * 5, 90, 90);
                rebarList.Add(rebarBase1);
            }
            //水平底部
            for (int i = 0; i < 3; i++)
            {
                LineElement lineElement = new LineElement(GeneralBank.ActiveDgnModel, null, new DSegment3d(
                    new DPoint3d(-bracingBramParameter.bracingBeamWidth / 2 + padding + putDistance * i, rebarLength / 2,  padding) * GeneralBank.UorToMeters,
                    new DPoint3d(-bracingBramParameter.bracingBeamWidth / 2 + padding + putDistance * i, -rebarLength / 2, padding) * GeneralBank.UorToMeters));
                RebarBase rebarBase1 = new Rebar_90Degrees(this, "1", rebar1.diameter, rebar1.rebarGrade, RebarType.NoRibbed, lineElement.GetCurveVector(), rebar1.hookLength, rebar1.diameter * 5, -90, -90);
                rebarList.Add(rebarBase1);
            }
            putDistance = (bracingBramParameter.bracingBeamWidth - padding * 2);

            //竖向左
            LineElement lineElementL = new LineElement(GeneralBank.ActiveDgnModel, null, new DSegment3d(
                new DPoint3d(-bracingBramParameter.bracingBeamWidth / 2 + padding , rebarLength / 2, bracingBramParameter.bracingBeamHeight / 2) * GeneralBank.UorToMeters,
                new DPoint3d(-bracingBramParameter.bracingBeamWidth / 2 + padding , -rebarLength / 2, bracingBramParameter.bracingBeamHeight / 2) * GeneralBank.UorToMeters));
            RebarBase rebarBaseL = new Rebar_90Degrees(this, "1", rebar1.diameter, rebar1.rebarGrade, RebarType.NoRibbed, lineElementL.GetCurveVector(), rebar1.hookLength, rebar1.diameter * 5, 180, 180);
            rebarList.Add(rebarBaseL);
            //竖向右
            LineElement lineElementR = new LineElement(GeneralBank.ActiveDgnModel, null, new DSegment3d(
                new DPoint3d(bracingBramParameter.bracingBeamWidth / 2 - padding, rebarLength / 2, bracingBramParameter.bracingBeamHeight / 2) * GeneralBank.UorToMeters,
                new DPoint3d(bracingBramParameter.bracingBeamWidth / 2 - padding, -rebarLength / 2, bracingBramParameter.bracingBeamHeight / 2) * GeneralBank.UorToMeters));
            RebarBase rebarBaseR = new Rebar_90Degrees(this, "1", rebar1.diameter, rebar1.rebarGrade, RebarType.NoRibbed, lineElementR.GetCurveVector(), rebar1.hookLength, rebar1.diameter * 5, 0, 0);
            rebarList.Add(rebarBaseR);
            return rebarList;
        }

        private List<RebarBase> CreateRebarListNum2()
        {
            List<RebarBase> rebarList = new();
            var bracingBramParameter = GetBracingBeamParameter();
            var rebar1 = GetRebarParametersOfNum1();
            var rebar2 = GetRebarParametersOfNum2();
            double padding = 7.0 / 100;
            object obj = new DataTable().Compute(rebar2.rebarGroup, null);
            string[] rebarEquation = rebar2.rebarGroup.ToString().Split('+');
            //摆放起点
            double staY =  -Convert.ToDouble(obj)/100 / 2 ;
            double LL =  rebar2.diameter / 1000 / 2 + rebar1.diameter / 1000 / 2;

            DPoint3d leftUp = new DPoint3d(-bracingBramParameter.bracingBeamWidth / 2 + padding - LL, staY + rebar2.diameter / 1000/2, bracingBramParameter.bracingBeamHeight - padding + LL) * GeneralHelpers.UorToMeters;
            DPoint3d rightUp = new DPoint3d(bracingBramParameter.bracingBeamWidth / 2 - padding + LL, staY, bracingBramParameter.bracingBeamHeight - padding +LL) * GeneralHelpers.UorToMeters;
            DPoint3d rightDown = new DPoint3d(bracingBramParameter.bracingBeamWidth / 2 - padding + LL, staY, padding - LL) * GeneralHelpers.UorToMeters;
            DPoint3d leftDown = new DPoint3d(-bracingBramParameter.bracingBeamWidth / 2 + padding - LL, staY, padding - LL) * GeneralHelpers.UorToMeters;
            DPoint3d leftUpEnd = new DPoint3d(-bracingBramParameter.bracingBeamWidth / 2 + padding - LL, staY - rebar2.diameter/1000/2, bracingBramParameter.bracingBeamHeight - padding + LL) * GeneralHelpers.UorToMeters;

            double radius = rebar2.diameter ;
            var hook_RightUp = CreateArcByLineToLine(new DSegment3d(leftUp, rightUp), new DSegment3d(rightUp, rightDown), radius);
            var hook_RightDown = CreateArcByLineToLine(new DSegment3d(rightUp, rightDown), new DSegment3d(rightDown, leftDown), radius);
            var hook_LeftDown = CreateArcByLineToLine(new DSegment3d(rightDown, leftDown), new DSegment3d(leftDown, leftUp), radius);
            ComplexStringElement retComplexString = new(GeneralBank.ActiveDgnModel,null);
            LineElement lineElement1 = new LineElement(GeneralBank.ActiveDgnModel, null, new DSegment3d(leftUp, (DPoint3d)hook_RightUp.tangentPointOnLine1));
            ArcElement arcElement1 = new ArcElement(GeneralBank.ActiveDgnModel, null, (DEllipse3d)hook_RightUp.dEllipse);
            LineElement lineElement2 = new LineElement(GeneralBank.ActiveDgnModel, null, new DSegment3d((DPoint3d)hook_RightUp.tangentPointOnLine2, (DPoint3d)hook_RightDown.tangentPointOnLine1));
            ArcElement arcElement2 = new ArcElement(GeneralBank.ActiveDgnModel, null, (DEllipse3d)hook_RightDown.dEllipse);
            LineElement lineElement3 = new LineElement(GeneralBank.ActiveDgnModel, null, new DSegment3d((DPoint3d)hook_RightDown.tangentPointOnLine2, (DPoint3d)hook_LeftDown.tangentPointOnLine1));
            ArcElement arcElement3 = new ArcElement(GeneralBank.ActiveDgnModel, null, (DEllipse3d)hook_LeftDown.dEllipse);
            LineElement lineElement4 = new LineElement(GeneralBank.ActiveDgnModel, null, new DSegment3d((DPoint3d)hook_LeftDown.tangentPointOnLine2, leftUpEnd));

            retComplexString.AddComponentElement(lineElement1);
            retComplexString.AddComponentElement(arcElement1);
            retComplexString.AddComponentElement(lineElement2);
            retComplexString.AddComponentElement(arcElement2);
            retComplexString.AddComponentElement(lineElement3);
            retComplexString.AddComponentElement(arcElement3);
            retComplexString.AddComponentElement(lineElement4);

            double joingLength = 0;
            for (int i = 0; i < rebarEquation.Length; i++)
            {
                int index = 0;
                int root =  Convert.ToInt32(rebarEquation[i].Split('*')[0]);
                double distance = Convert.ToDouble(rebarEquation[i].Split('*')[1]) / 100;
                if (i > 0)
                {
                    index = 1;
                } 

                for (int j = index; j < root + 1; j++)
                {
                    Element element = null;
                    using (ElementCopyContext elementCopy = new ElementCopyContext(GeneralBank.ActiveDgnModel))
                    {
                        elementCopy.WriteElements = false;
                        element = elementCopy.DoCopy(retComplexString);
                    }
                    
                    DPoint3d movePoint3d = new DPoint3d(0, joingLength + distance * j, 0) * GeneralBank.UorToMeters;
                    DTransform3d trans = DTransform3d.Identity;
                    trans.Translation = movePoint3d;
                    TransformInfo transformInfo = new TransformInfo(trans);  
                    element.ApplyTransform(transformInfo);

                    ComplexStringElement complexString = element as ComplexStringElement;
                    RebarBase rebarBase = new Rebar_135Degrees(this, "2", rebar2.diameter, rebar2.rebarGrade, RebarType.Ribbed, complexString.GetCurveVector(), rebar2.hookLength, rebar2.diameter * 5, 90, 180);
                    rebarList.Add(rebarBase);
                    element.Dispose();
                }
                joingLength += distance * root;
            }
            return rebarList;   
        }

        public static (DEllipse3d? dEllipse, DPoint3d? tangentPointOnLine1, DPoint3d? tangentPointOnLine2) CreateArcByLineToLine(DSegment3d line1, DSegment3d line2, double radius)
        {
            if (line1.UnitTangent.IsParallelOrOppositeTo(line2.UnitTangent))
            {
                return (null, null, null);
            }
            line1.UnitTangent.TryNormalize(out DVector3d tangentVector1);
            line2.UnitTangent.TryNormalize(out DVector3d tangentVector2);
            line1.UnitTangent.CrossProduct(line2.UnitTangent).TryNormalize(out DVector3d nomarlVector);
            nomarlVector.CrossProduct(line1.UnitTangent).TryNormalize(out DVector3d vectorLine1);
            nomarlVector.CrossProduct(line2.UnitTangent).TryNormalize(out DVector3d vectorLine2);
            var angle = Math.PI - Math.Acos(line1.UnitTangent.DotProduct(line2.UnitTangent));
            var startPoint = line1.EndPoint - line1.UnitTangent * radius * 0.001 * GeneralHelpers.UorToMeters * (1.0 / Math.Tan(angle * 0.5));
            var endPoint = line2.StartPoint + line2.UnitTangent * 0.001 * GeneralHelpers.UorToMeters * radius * (1.0 / Math.Tan(angle * 0.5));
            var centerPoint = startPoint + (vectorLine1 * radius * 0.001 * GeneralHelpers.UorToMeters);
            var midVector = new DVector3d(centerPoint, line1.EndPoint);
            midVector.TryNormalize(out DVector3d midNormalVector);
            var midPoint = centerPoint + midNormalVector * radius * 0.001 * GeneralHelpers.UorToMeters;
            DEllipse3d.TryCircularArcFromStartMiddleEnd(startPoint, midPoint, endPoint, out DEllipse3d ret);
            return (ret, startPoint, endPoint);
        }

        /// <summary>
        /// 获取1#钢筋构造参数
        /// </summary>
        /// <returns>等级，直径，钢筋根数，弯钩长度</returns>
        private (string rebarGrade, double diameter, int rebarRoot, double hookLength) GetRebarParametersOfNum1()
        {
            var dgvOfRebar = this.rebarEntity.dgv_Rebar1;
            var rebarGrade = Convert.ToString(dgvOfRebar[0]);
            var diameter = Convert.ToDouble(dgvOfRebar[1]);
            var rebarRoot = Convert.ToInt32(dgvOfRebar[2]);
            var hookLength = Convert.ToDouble(dgvOfRebar[3]);
            return (rebarGrade, diameter, rebarRoot, hookLength);
        }

        /// <summary>
        /// 获取2#钢筋构造参数
        /// </summary>
        /// <returns>等级，直径，钢筋组合，弯钩长度</returns>
        private (string rebarGrade, double diameter,string rebarGroup,  double hookLength) GetRebarParametersOfNum2()
        {
            var dgvOfRebar = this.rebarEntity.dgv_Rebar2;
            var rebarGrade = Convert.ToString(dgvOfRebar[0]);
            var diameter = Convert.ToDouble(dgvOfRebar[1]);
            var rebarGroup = Convert.ToString(dgvOfRebar[2]);
            var hookLength = Convert.ToDouble(dgvOfRebar[3]);
            return (rebarGrade, diameter, rebarGroup, hookLength);
        }


        /// <summary>
        /// 获取分离式洞身构造参数
        /// </summary>
        /// <returns> 涵长,左偏角,右偏角,涵身沉降缝宽度,基础沉降缝宽度,涵底坡度, 净跨,净高,挡块高度,基础襟边,台身厚度,基础宽度,台身顶宽,基础厚度,净保护层</returns>
        /// 
        private (double basicsLength, double leftLateralAngle, double rightLateralAngle, double culvertGapWidth, double baseGapWidth, double baseSlope, double clearSpan, double clearHeight,
            double piecePly, double basicsEdge, double standPly,double basicsWidth, double standTopWidth, double basicsPly, double protectiveLayer ) GetUorCoverParameter()
        {
            double basicsLength = this.basicConstructor.BasicsLength / 100;
            double leftLateralAngle = this.basicConstructor.LeftLateralAngle;
            double rightLateralAngle = this.basicConstructor.RightLateralAngle;
            double culvertGapWidth = this.basicConstructor.CulvertGapWidth / 100;
            double baseGapWidth = this.basicConstructor.BaseGapWidth / 100;
            double baseSlope = this.basicConstructor.CulvertBaseSlope / 100;
            double clearSpan = this.basicConstructor.ClearSpan;
            double clearHeight = this.basicConstructor.ClearHeight;
            double piecePly = this.basicConstructor.PiecePly / 100;
            double basicsEdge = this.basicConstructor.BasicsEdge / 100;
            double standPly = this.basicConstructor.StandPly / 100;
            double basicsWidth = this.basicConstructor.BasicWidth / 100;    
            double standTopWidth = this.basicConstructor.StandTopWidth / 100;
            double basicsPly = this.basicConstructor.BasicsPly / 100;
            double protectiveLayer = this.basicConstructor.ProtectiveLayer;
            return (basicsLength, leftLateralAngle, rightLateralAngle, culvertGapWidth, baseGapWidth, baseSlope, clearSpan, clearHeight, piecePly, basicsEdge, standPly, basicsWidth,standTopWidth, basicsPly, protectiveLayer);
        }

        /// <summary>
        /// 获取支撑梁构造参数
        /// </summary>
        /// <returns>涵长分段, 长度，高度，宽度，主筋边距</returns>
        private (List<double> culvertLenLists ,double racingBeamLength, double bracingBeamHeight, double bracingBeamWidth, double bracingBeamInterva) GetBracingBeamParameter()
        {
            List<double> culvertLenLists = this.basicConstructor.CulvertLenLists;
            double racingBeamLength = this.basicConstructor.BracingBeamLength /100;
            double bracingBeamHeight = this.basicConstructor.BracingBeamHeight /100;
            double bracingBeamWidth = this.basicConstructor.BracingBeamWidth /100;
            double bracingBeamInterva = this.basicConstructor.BracingBeamInterval/100;
            return (culvertLenLists,racingBeamLength, bracingBeamHeight, bracingBeamWidth, bracingBeamInterva);
        }


        public override void CreateElementECProperty(Element element, List<Tuple<string, CustomProperty.TypeKind, bool, bool>> tuples)
        {
            throw new NotImplementedException();
        }


        public override List<(string standardName, string standValue)> CreateStandardECProperty()
        {
            throw new NotImplementedException();
        }

        public override double GetVolumeOfElement(Element element)
        {
            throw new NotImplementedException();
        }

        public override void SaveStandardECProperty(IDgnECInstance dgnECInstanc)
        {
            throw new NotImplementedException();
        }

        public override void SetECInstanceValue(IDgnECInstance dgnECInstance, List<(string propertyName, string calculationBasis, string computationalFormula)> propertyData)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// 基于dPoint3D点沿X轴绘制线
        /// </summary>
        /// <param name="boxCulvertLength">涵长水平距离</param>
        /// <param name="slop">坡度; (例如0.1就是10%的坡率)</param>
        /// <returns></returns>
        public LineElement GetSlopLinee(DPoint3d dPoint3D, double boxCulvertLength, double slop, out DPoint3d endPt)
        {
            double z = boxCulvertLength * slop;
            endPt = new DPoint3d(dPoint3D.X + boxCulvertLength, dPoint3D.Y, dPoint3D.Z + z) * GeneralBank.UorToMeters;
            return new LineElement(GeneralBank.ActiveDgnModel, null, new DSegment3d(dPoint3D * GeneralBank.UorToMeters, new DPoint3d(dPoint3D.X + boxCulvertLength, dPoint3D.Y, dPoint3D.Z + z) * GeneralBank.UorToMeters));
        }

        public SolidKernelEntity CreateBodyFromSweep(CurveVector pathCur, CurveVector secCur, DgnModel modelRef)
        {
            pathCur.GetStartEnd(out DPoint3d startPt, out _, out DVector3d startTangent, out _);
            CurveVector secCur1 = secCur.Clone();
            BCIMNETGS.SolidUtil.Create.BodyFromSweep(out SolidKernelEntity entity, secCur1, pathCur, modelRef, false, true, false, null, null, null, null);
            return entity;
        }
    }
}
